package com.example.testapplication.JetPact;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.example.testapplication.bean.Star;
import com.example.testapplication.xueJetpackViewModel;

public class StarViewModel extends ViewModel {
    MutableLiveData<Star> mutableLiveData = new MutableLiveData<>();

    public MutableLiveData<Star> getMutableLiveData() {
        return mutableLiveData;
    }

    public void addFans() {
        Star star = mutableLiveData.getValue();
        int number = star.getFans();
        star.setFans(number + 1);
        mutableLiveData.postValue(star);
    }
}
